{include file="header.html"}
<div style="padding:0 10px 10px 10px;">
	<table border="0" align="center" cellpadding="8" cellspacing="0" class="tableConfig">
		<tbody>
			<tr class="tdbg item_title">
				<td align="right"><i class="typcn typcn-cog"></i> 上传<font class="title"></font></td>
				<td></td>
			</tr>
			<tr class="tdbg">
			  <td align="right" class="config_td_first">选择上传的库类型：</td>
			  <td class="icheck_radios"><label><input type="radio" id="dbtype1" name="dbtype" value="1" checked>模型公共库</label>
					<label><input type="radio" id="dbtype2" name="dbtype" value="2">指定网站分组库</label>
				</td>
			</tr>
			<tr id="module_tr">
				<td align="right">所属模型：</td> 
				<td align="left"><select name="arctype" id="arctype" onchange="change_type(this.value);">
				{foreach $class_list as $k=>$vo}
					<option value="{$vo.dirname}">{$vo.name}</option>
				{/foreach}
					</select>
				</td>
			</tr>
			<tr id="domain_tr" style="display:none">
				<td align="right">网站分组：</td> 
				<td align="left"><select name="domaincid" id="domaincid" onchange="change_type(this.value);">
				{foreach $domainlist as $k=>$vo}
					<option value="{$vo.dirname}">{$vo.name}</option>
				{/foreach}
					</select>
				</td>
			</tr>
			<tr>
			  <td align="right" width="150" class="config_td_first">上传文件：</td>
			  <td id="updiv">
				<div id="up{$input_name}" class="uploader">
					<div class="uploader-list"></div>
					<div class="uploader-btns">
						<div class="picker">选择文件</div>
						<button type="button" class="uploadbtn button button_grey">开始上传</button>
					</div>
				</div>
				<div style="padding-top:10px;color:green">上传<font class="title"></font>txt，支持多选，不建议使用中文文件名</div>
			  </td>
			</tr>
			{if $input_name=='article'}
				<tr><td>&nbsp;</td><td><font color="red">文章库每行一篇文章，格式：标题******内容</font></td></tr>
			{/if}
		</tbody>
	</table>
</div>
<style type="text/css">
.webuploader-container .webuploader-pick .webuploader-pick{ padding:0;}
</style>
<script type="text/javascript">
var type=top.art.dialog.data('type');
var dbtype=1;
$("#arctype").find("option[value='"+type+"']").attr("selected",true);
upload('#up{$input_name}','txt',null,'{$input_name}/'+$('#arctype').val()+'?'+dbtype);
$('.title').html(top.art.dialog.data('title'));
var html=$('#updiv').html();
var i=1;

$("#dbtype2").on('ifChecked', function(event) {
	$('#module_tr').hide();
	$('#domain_tr').show(500);
	dbtype=2;
	var domaincid=$("#domaincid").val();
	change_type(domaincid);
});
$("#dbtype1").on('ifChecked', function(event) {
	$('#domain_tr').hide();
	$('#module_tr').show(500);
	dbtype=1;
	var arctype=$("#arctype").val();
	change_type(arctype);
});
function change_type(value){
	$('#updiv').html('');
	var newhtml=html.replace('up{$input_name}','up{$input_name}'+i);
	$('#updiv').html(newhtml);
	upload('#up{$input_name}'+i,'txt',null,'{$input_name}/'+value+'?'+dbtype);
	i++;
}
</script>